import { createI18n } from "vue-i18n";
// 本地语言包
import enLocale from "./package/en";
import zhCnLocale from "./package/zh-cn";

import zhCn from "element-plus/lib/locale/lang/zh-cn";
import en from "element-plus/lib/locale/lang/en";


const messages = {
    'zh': {
        ...zhCn,
        ...zhCnLocale
    },
    'en': {
        ...en,
        ...enLocale
    }
};
import store from '@/store/index';
import useAppStore from "@/store/modules/app";

const appStore = useAppStore(store);
const i18n = createI18n({
    legacy: false,
    locale: appStore.language,
    fallbackLocale: 'en',
    messages: messages,
    globalInjection: true,
});

export default i18n;
